<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<%@ include file="../../include/pGrid.jsp" %>
<title>合同分包合同统计</title>
<script>
	$(function(){
		var param = {contractNo: '${param.contractNo}',contractNo_searchType:'eq'};
		$.getJSON('/console/com.fs.jzzn.pojo.Contract/list', param , function(result){
			var rows = result.rows;
			if(rows.length>0){
				$('#queryForm').form("load",rows[0] );
			}
		});
		
		/*列表初始化*/
		var gridParam = {
			url : '/console/statistics/rewrite/contractlist',
			columns: [[ 
				{field: 'contractNo', title: '订单编号', width: 120}
				,{field: 'outContractNo', title: '合同编号', width: 120}
				,{field: 'contractType', title: '合同类型', width: 160}
				,{field: 'contractName', title: '合同名称', width: 120}
				,{field: 'signDate', title: '签订日期', width: 120}
				,{field: 'partA', title: '合同甲方', width: 120}
				,{field: 'partB', title: '合同乙方', width: 120}
				,{field: 'partAuser', title: '甲方经办人', width: 120}
				,{field: 'partAphone', title: '甲方联系电话', width: 120}
				,{field: 'partBuser', title: '乙方经办人', width: 120}
				,{field: 'partBphone', title: '乙方联系电话', width: 120}
				,{field: 'budgetMoney', title: '预算金额', width: 90}
				,{field: 'actualMoney', title: '实际金额', width: 90}
				,{field: 'billMoney', title: '开票金额', width: 90}
				,{field: 'auditMoney', title: '审计金额', width: 90}
				,{field: 'returnedMoney', title: '回款金额', width: 90}
				,{field: 'payDesc', title: '付款情况及说明', width: 130}
				,{field: 'mainUnit', title: '总包单位', width: 120}
				,{field: 'assistUnit', title: '分包单位', width: 120}
			]],
			queryParams:{
				contractNo : param.contractNo
			},
			onLoadSuccess:function(data){
				p.total({tip:'合计:', tipName:'pNo', 
					fields:[
				    	{name:'budgetMoney',total:'sum'},
				    	{name:'actualMoney',total:'sum'},
				    	{name:'billMoney',total:'sum'},
				    	{name:'auditMoney',total:'sum'},
				    	{name:'returnedMoney',total:'sum'}
					] 
				});
			},
			singleSelect : true
		};
		p.dataGrid = $(p.dataGrid).datagrid( $.extend({}, p.dataGridParam, gridParam));

		/*事件响应*/
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var motion_code = $(this).attr("motion_code");p.btnOneClick($(this));
			switch (motion_code) {
				case "05":
					p.gridQuery();
					break;
				case "07":
					p.down({filename:'合同分包合同统计',url:'/console/income/export',local:true });
					break;
				default:
					break;
			}
		});
	});
</script>
</head>
<body  class="easyui-layout">
		<!-- 但行高度33px，多行时 33乘以行数  -->
		<div id="querybar" data-options="region:'north',split:false,border:false" style="height:33px;">
			<div class="easyui-panel" data-options="fit:true,border:false">
				<!-- 查询条件表单，根据配置进行替换  -->
				<form id="queryForm" >
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<input class="easyui-textbox" name="contractNo" style="width:280px;" data-options="label:'订单编号:'" />
				 </div>
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<input class="easyui-textbox" name="contractName" style="width:280px;" data-options="label:'合同名称:'" />
				 </div>
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<input class="easyui-textbox" name="outContractNo" style="width:280px;" data-options="label:'合同编号:'" />
				 </div>
				</form>
			</div>
		</div>  
	
		<!-- 工具栏按钮 -->
		<div id="toolbar" class="easyui-panel" style="padding:3px;">
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" motion_code="05">刷新</a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-excel" plain="true" motion_code="07">导出</a>
		</div>
		
		<!-- 表格 -->
		<div region="center" border="false">
			<table id="dataGrid"></table>
		</div>
</body>
</html>